package com.chao.a.controller;

import com.chao.a.service.WebBService;
import com.chao.c.dto.Student;
import com.chao.c.feign.ServiceCFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Luck Chao
 * @Date: 2021/12/07
 */
@Slf4j
@RequestMapping
@RestController
public class WebController {

    @Autowired
    private WebBService webBService ;

    @Autowired
    private ServiceCFeignClient serviceCFeignClient ;

    @GetMapping(value = "/index")
    public String index() {
        log.info(">>>>>>>>>>>>>{} receive msg >>>>>>>>>>>>>", "service A");
        return "Hello World !!";
    }

    @GetMapping(value = "/a2bindex")
    public String a2bindex() {
        log.info(">>>>>>>>> a2bindex >>>>>>>>");
        return webBService.index();
    }

    @GetMapping(value = "/a2b1")
    public String a2b1() {
        log.info(">>>>>>>>> a2b1 >>>>>>>>");
        return webBService.index1("a2b1");
    }

    @GetMapping(value = "/a2b2")
    public String a2b2() {
        log.info(">>>>>>>>> a2b2 >>>>>>>>");
        return webBService.index2("a2b2");
    }

    @GetMapping(value = "/a2b3")
    public String a2b3() {
        log.info(">>>>>>>>> a2b3 >>>>>>>>");
        return webBService.index3("a2b3");
    }

    @GetMapping(value = "/a2b4")
    public String a2b4() {
        log.info(">>>>>>>>> a2b4 >>>>>>>>");
        return webBService.index4("a2b4");
    }





    @GetMapping(value = "/a2cindex")
    public String a2cindex() {
        log.info(">>>>>>>>> a2cindex >>>>>>>>");
        return serviceCFeignClient.index();
    }

    @GetMapping(value = "/a2c1")
    public String a2c1() {
        log.info(">>>>>>>>> a2c1 >>>>>>>>");
        return serviceCFeignClient.index1("a2c1");
    }

    @GetMapping(value = "/a2c2")
    public String a2c2() {
        log.info(">>>>>>>>> a2c2 >>>>>>>>");
        Student student = new Student();
        student.setAge(18);
        student.setName("xiaoming");
        return serviceCFeignClient.index2(student);
    }









}
